perm filename SAIINP.FAI[S,AIL]1 blob
sn#102575 filedate 1974-05-22 generic text, type T, neo UTF8
COMPIL(INP,<INPUT>
,<SAVE,.SKIP.,INSET,RESTR,SIMIO,GETCHN,STRNGC,BRKMSK,X33,NOTOPN,GOGTAB
>
,<STRING INPUT ROUTINE>)
.IN.:
HERE (INPUT)
MOVE USER,GOGTAB ;GET TABLE POINTER
MOVE TEMP,(P)
MOVEM TEMP,UUO1(USER)
MOVEM RF,RACS+RF(USER);SAVE F-REGISTER
SKIPE SGLIGN(USER)
PUSHJ P,INSET
MOVE CHNL,-2(P) ;CHANNEL #
LOADI7 A,<IN> ;ROUTINE NAME
PUSHJ P,GETCHN ;SET UP, VALIDATE
LDB E,[POINT 4,DMODE(CDB),35] ;DATA MODE
CAIGE E,15 ;DUMP MODE?
SETZM @ENDFL(CDB) ;NO, HELP USER ASSUME NO EOF,ERR
SETZM @BRCHAR(CDB) ;ASSUME NO BREAK CHAR
CMU <
SETZM .SKIP.
>;CMU
HRRZ A,@ICOUNT(CDB) ;MAX COUNT FOR INPUT STRING
ADDM A,REMCHR(USER)
SKIPLE REMCHR(USER) ;ENOUGH ROOM?
PUSHJ P,STRNGC ;NO, TRY TO GET SOME
SKIPL C,-1(P) ;GET TABLE #, CHECK IN BOUNDS
CAILE C,=18
ERR <IN: THERE ARE ONLY 18 BREAK TABLES>
HRRZ TEMP,USER
ADD TEMP,C ;TABLE NO(USER)
MOVEI Z,1 ;FOR TESTING LINE NUMBERS
SKIPN LINTBL(TEMP) ;DON'T LET TEST SUCCEED IF
MOVEI Z,0 ;WE'RE TO LET LINE NUMBERS THRU
MOVN B,A ;NEGATE MAX CHAR COUNT
PUSH SP,[0] ;LEAVE ROOM FOR FIRST STR WORD
PUSH SP,TOPBYTE(USER) ;SECOND STRING WORD
MOVE FF,BRKMSK(C) ;GET MASK FOR THIS TABLE
HRRZ Y,USER
ADD Y,[XWD D,BRKTBL] ;BRKTBL+RLC(USER)
JUMPE B,DONE1 ; BECAUSE THE AOJL WON'T
CMU <
MOVS C,DMODE(CDB) ;FUNNY MODE BITS TO RH
>;CMU
TRNE FF,@BRKCVT(USER) ;DOING UC COERCION?
TLOA C,400000 ;YES
TLZ C,400000 ;NO
.IN: SOSG ICOWNT(CDB) ;BUFFER EMPTY?
JRST DOINP ;YES, GET MORE
IN1:
ILDB D,IBP(CDB) ;GET NEXT CHARACTER
TDNE Z,@IBP(CDB) ;LINE NUMBER (ALWAYS SKIPS IF NOT WORRIED)?
JRST INLINN ;YES, GO SEE WHAT TO DO
IN2:
NOCMU <
JUMPE D,.IN ;ALWAYS IGNORE 0'S
>;NOCMU
CMU <
JUMPE D,[ TRNN C,1 ;REALLY IGNORE NULL??
JRST .IN ;YES
JRST .+1 ;NOPE
]
>;CMU
SKIPE LINNUM(CDB) ;COUNTING VIA SETPL?
JRST [ CAIN D,12 ;LF?
AOS @LINNUM(CDB) ;YES -- BUMP COUNT
CAIE C,14 ;FF?
JRST .+1 ;NOPE
SKIPN PAGNUM(CDB) ;BE SURE NO MESSUP
ERR <DRYROT -- SETPL LOSSAGE DETECTED IN INPUT>,1,NOCV.I
AOS @PAGNUM(CDB) ;BUMP PAGE COUNT
SETZM @LINNUM(CDB) ;THE LINE COUNT ← 0
JRST NOCV.I ;SINCE KNOW NOT LOWER CASE
]
JUMPGE C,NOCV.I ;NOT COERCIING ??
CAIL D,"a" ;ONLY COERCE LOWER CASE
CAILE D,"z" ;
JRST .+2 ;FAST SKIP
TRZ D,40 ;MAKE UC
NOCV.I: TDNE FF,@Y ;MUST WE DO SOMETHING SPECIAL?
JRST INSPC ;YES, HANDLE
MOVEC: IDPB D,TOPBYTE(USER) ;LENGTHEN STRING
AOJL B,.IN ;GET SOME MORE
JRST DONE1
INSPC: HLLZ TEMP,@Y ;IGNORE OR BREAK?
TDNN TEMP,FF ; (CHOOSE ONE)
JRST .IN ;IGNORE
DONE: MOVEM D,@BRCHAR(CDB) ;STORE BREAK CHAR
MOVE Y,-1(P) ;TABLE # AGAIN
ADD Y,USER ;RELOCATE
SKIPN Y,DSPTBL(Y) ;WHAT TO DO WITH BREAK CHAR?
JRST DONE1 ;SKIP IT
JUMPL Y,APPEND ;ADD TO END OF INPUT STRING
RETAIN: SOS IBP(CDB) ;BACK UP TO GET IT NEXT TIME
FOR II←1,4 <
IBP IBP(CDB)>
AOS ICOWNT(CDB)
JRST DONE1
APPEND: IDPB D,TOPBYTE(USER) ;PUT ON END
AOJA B,DONE1 ;ONE MORE TO COUNT
INEOF1: POP P,D+1 ;LEFT OVER FROM DUMP MODE ROUT
DONE1: ADDM B,REMCHR(USER) ;GIVE UP THOSE NOT USED
ADD B,@ICOUNT(CDB) ;HOW MANY DID WE ACTUALLY GET?
HRROM B,-1(SP) ;MARK RESULT, NON-CONSTANT
MOVE RF,RACS+RF(USER);GET F-REGISTER BACK
SUB P,X33 ;REMOVE INPUT PARAMETER, RETURN ADDRESS
JRST @3(P) ;RETURN
DOINP:
CMU <
AOS .SKIP.
>;CMU
CAIL E,15 ;DUMP MODE?
JRST DMPI ; YES
XCT IOIN,SIMIO ;IN CHAN,0
JRST IN1 ;ALL OK, CONTINUE
JRST DONE1 ;ERROR OR EOF, QUIT
DMPI: PUSH P,D+1
HRRZ D,IBUF(CDB) ;PTR TO BUFFER AREA
SUBI D,1
HRLI D,-=128
MOVEI D+1,0
XCT IODIN,SIMIO ;IN CHAN,D
JRST OKI
JRST INEOF1 ;REMOVE D,QUIT
OKI: POP P,D+1
AOS @ENDFL(CDB) ;SPECIAL TREATMENT
HRLI D,700
MOVEM D,IBP(CDB)
MOVEI A,5*=128
MOVEM A,ICOWNT(CDB)
JRST IN1 ;DONE SIMULATING, RETURN
INLINN:
SKIPE SOSNUM(CDB) ;DOES THE USER WANT IT???
JRST [ MOVE TEMP,@IBP(CDB) ;YES
MOVEM TEMP,@SOSNUM(CDB);
JRST .+1 ]
MOVE TEMP,-1(P) ;GET LINE NUMBER DISPOSITION FLAG,
ADD TEMP,USER ;RLC+TABLE
SKIPGE TEMP,LINTBL(TEMP) ;LINTBL+RLC+TABLE
JRST GIVLIN ; WANTS IT NEXT TIME OR SOMETHING
JSP TEMP,EATLIN ;TOSS IT OUT, AND
JRST .IN ; CONTINUE
EATLIN:
AOS IBP(CDB) ;FORGET IT ENTIRELY
MOVNI A,5 ;INDICATE SKIPPING SIX
ADDB A,ICOWNT(CDB) ;IN COUNT
JUMPG A,(TEMP) ;NO, CONTINUE
CAIL E,15
ERR <CAN'T HANDLE THIS FILE IN DUMP MODE>
XCT IOIN,SIMIO ;YES, GET TAB FROM NEXT BUFFER
JRST OKLN ;GOT IT, CONTINUE
JRST DONE1
OKLN: SOSG ICOWNT(CDB) ;IF ONLY ONE CHAR,
JRST [MOVEI TEMP,20000 ;THEN EOF COMES NEXT
IORM TEMP,@ENDFL(CDB)
JRST DONE1] ;ALL DONE
IBP IBP(CDB) ;GET OVER TAB FINALLY
AOS ICOWNT(CDB) ;INCREMENT COUNT
JRST (TEMP) ;AND CONTINUE
GIVLIN: TRNE TEMP,-1 ;WANT LINE NO IN BRCHAR WORD?
JRST GVLLN ;NO, WANTS IT NEXT TIME.
SKIPL TEMP,@IBP(CDB) ;NEGATED LINE NO
MOVNS TEMP
MOVEM TEMP,@BRCHAR(CDB) ;STORE WHERE HE WANTS IT
JSP TEMP,EATLIN ;GO EAT UP LINE NUMBER AND
JRST DONE1 ;FINISH UP
GVLLN:
SETOM @BRCHAR(CDB) ;TELL THE USER
AOS ICOWNT(CDB) ;REVERSE THE SOSLE
MOVEI Y,1 ;TURN OFF LINE NUMBER
ANDCAM Y,@IBP(CDB) ; BIT
MOVSI Y,070000 ;BACK UP BYTE POINTER
ADDM Y,IBP(CDB)
JRST DONE1 ;FINISH OFF IN BAZE OF GORY
ENDCOM(INP)